function doSearch() {
	$('#tt').datagrid('load', {
		name : $('#name').val()
	});
	$('#tt').datagrid('unselectAll');
}


function formatEnable(value, row, index){
	if (row.isEnable == 1) {
		return "启用";
	} else {
		return "作废";
	}
}

function add() {
	showMyWindow('脚本管理 |新增', '/script/addScriptItem', 500, 300);
}

function abandon() {
	var row = $('#tt').datagrid('getSelected');
	var name = row.name;
	var isEnable = row.isEnable;
	if(isEnable == 0 ){
		top.showMsg(market.content.title, "数据已经是废弃状态", alert);
		return;
	}else{
		$.messager.confirm('温馨提醒', '你确定废弃本条数据吗？', function(r) {
			if (r) {
				$.get('/script/abandon?name=' + name, function(data) {
					if (data.return_code == '1') {
						top.showMsg(market.content.title, data.return_msg, alert);
						doSearch();
					} else {
						$.messager.alert(market.content.title, data.return_msg);
					}
				});
			}
		});
	}
}
